package org.larkdoc.service.impl;

import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.larkdoc.dao.DocRelProjectMapper;
import org.larkdoc.model.entity.DocRelProject;
import org.larkdoc.service.DocRelProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 文档与项目关系业务功能实现类 
 * 
 * @author  zhangpeijun[zhangpeijun1024@qq.com]
 * @version  [v1.0.1, 2017年10月17日]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
@Service("docRelProjectService")
public class DocRelProjectServiceImpl implements DocRelProjectService {
    
    @Autowired
    private DocRelProjectMapper mapper;
    
    @Override
    public int deleteByProjectId(Integer projectId) {
        if (null != projectId && projectId > 0) {
            return mapper.deleteByProjectId(projectId);
        } else {
            return 0;
        }
    }
    
    @Override
    public int insertBatch(List<DocRelProject> records) {
        if (CollectionUtils.isNotEmpty(records)) {
            return mapper.insertBatch(records);
        } else {
            return 0;
        }
    }
    
    @Override
    public int deleteByDocId(Integer docId) {
        if (null != docId && docId > 0) {
            return mapper.deleteByDocId(docId);
        } else {
            return 0;
        }
    }
    
    @Override
    public List<DocRelProject> selectByDocIds(List<Integer> ids) {
        if (CollectionUtils.isNotEmpty(ids)) {
            return mapper.selectByDocIds(ids);
        } else {
            return null;
        }
    }
    
}
